=========================================================================== BBS: The Abacus * HST/DS * Potterville, MI Date: 06-08-93 (03:05) Number: 203 From: RICH GELDREICH Refer#: NONE To: CALVIN FRENCH Recvd: NO Subj: Gif Loader/3 Conf: (35) Quick Basi --------------------------------------------------------------------------- '>>> Start of page 3. IF Code = ClearCode THEN NextCode = FirstCode CodeSize = StartCodeSize MaxCode = StartMaxCode GOSUB GetCode CurCode = Code: LastCode = Code: LastPixel = Code IF X < 320 AND y < 200 THEN POKE X + YBase, LastPixel X = X + 1: IF X = XEnd THEN GOSUB NextScanLine ELSE CurCode = Code: StackPointer = 0 'Have we entered this code into the dictionary yet? IF Code >= NextCode THEN IF Code > NextCode THEN GOTO AllDone 'Bad GIF if ' this happens. 'mimick last code if we haven't entered the ' requested 'code into the dictionary yet CurCode = LastCode OutStack(StackPointer) = LastPixel StackPointer = StackPointer + 1 END IF 'Recursively get each character of the string. 'Since we get the characters in reverse, "push" them 'onto a stack so we can "pop" them off later. 'Hint: There is another, much faster way to ' accomplish 'this that doesn't involve a decoding stack at all... DO WHILE CurCode >= FirstCode OutStack(StackPointer) = Suffix(CurCode) StackPointer = StackPointer + 1 CurCode = Prefix(CurCode) LOOP LastPixel = CurCode IF X < 320 AND y < 200 THEN POKE X + YBase, LastPixel X = X + 1: IF X = XEnd THEN GOSUB NextScanLine '"Pop" each character onto the display. FOR A = StackPointer - 1 TO 0 STEP -1 IF X < 320 AND y < 200 THEN POKE X + YBase,_ OutStack(A) X = X + 1: IF X = XEnd THEN GOSUB NextScanLine NEXT 'Can we put this new string into our dictionary? ' (Some GIF 'encoders will wait a bit when the dictionary is full 'before sending a clear code- this increases ' compression 'because the dictionary's contents are thrown away ' less 'often.) IF NextCode < 4096 THEN 'Store new string in the dictionary for later ' use. Prefix(NextCode) = LastCode Suffix(NextCode) = LastPixel NextCode = NextCode + 1 'Time to increase the LZW code size? IF (NextCode > MaxCode) AND (CodeSize < 12) THEN CodeSize = CodeSize + 1 MaxCode = MaxCode * 2 + 1 END IF END IF LastCode = Code END IF END IF LOOP UNTIL Code = EOSCode LOOP AllDone: 'Save image and palette to BSAVE file. 'DEF SEG = &HA000 'OUT &H3C7, 0 'FOR a = 0 TO 767 ' POKE a + 64000, INP(&HÃ9) 'NEXT '>>> Continued on page 4 --- MsgToss 2.0b * Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29) SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1 SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209 SEEN-BY: 261/1023 280/1 390/1 396/1 15 397/2 2230/100 2440/5 3603/20